package cc.javaee.bbs.dao.activity;


import cc.javaee.bbs.dao.BaseDao;
import cc.javaee.bbs.model.activity.KbrDynamicComment;
import cc.javaee.bbs.params.DbResultMap;
import cc.javaee.bbs.params.WebParams;
import cc.javaee.bbs.tool.DataFormatUtil;
import cc.javaee.bbs.tool.RelativeDateFormat;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class DynamicCommentDao extends BaseDao {
	String ns="kbr_dynamic_comment.";
	public void insert(KbrDynamicComment KbrDynamicComment) {
		this.getSqlSession().insert(ns+"insert", KbrDynamicComment);
	}
	public List<DbResultMap> findDbList(WebParams param) {
		List<DbResultMap> list=this.getSqlSession().selectList(ns+"findDb", param);
		if(list!=null&&list.size()>0){
			for (DbResultMap act : list) {
				act.put("createTimeStr", DataFormatUtil.toTimeStrNull(act.getDate("createTime")));
				act.put("commonTime", RelativeDateFormat.format(DataFormatUtil.toTimeStrNull(act.getDate("createTime"))));
			}
		}
		return list;
	}
	public List<DbResultMap> findDb(WebParams param) {
		return null;
	}
	
	public void addCommon(WebParams params) {
		// TODO Auto-generated method stub
		
	}
}